/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.AttrDefs;
import de.sabram.upb.specs.lido.AttrDefsOpt;
import de.sabram.upb.specs.lido.LidoPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Attr Defs Opt</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.AttrDefsOptImpl#getAttrDefs <em>Attr Defs</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AttrDefsOptImpl extends MinimalEObjectImpl.Container implements AttrDefsOpt
{
  /**
   * The cached value of the '{@link #getAttrDefs() <em>Attr Defs</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAttrDefs()
   * @generated
   * @ordered
   */
  protected AttrDefs attrDefs;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AttrDefsOptImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.ATTR_DEFS_OPT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AttrDefs getAttrDefs()
  {
    return attrDefs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAttrDefs(AttrDefs newAttrDefs, NotificationChain msgs)
  {
    AttrDefs oldAttrDefs = attrDefs;
    attrDefs = newAttrDefs;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS, oldAttrDefs, newAttrDefs);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAttrDefs(AttrDefs newAttrDefs)
  {
    if (newAttrDefs != attrDefs)
    {
      NotificationChain msgs = null;
      if (attrDefs != null)
        msgs = ((InternalEObject)attrDefs).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS, null, msgs);
      if (newAttrDefs != null)
        msgs = ((InternalEObject)newAttrDefs).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS, null, msgs);
      msgs = basicSetAttrDefs(newAttrDefs, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS, newAttrDefs, newAttrDefs));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS:
        return basicSetAttrDefs(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS:
        return getAttrDefs();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS:
        setAttrDefs((AttrDefs)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS:
        setAttrDefs((AttrDefs)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR_DEFS_OPT__ATTR_DEFS:
        return attrDefs != null;
    }
    return super.eIsSet(featureID);
  }

} //AttrDefsOptImpl
